Using WP-CLI to Manage WordPress on Ubuntu

  • Last Created On Nov 20, 2024
  • 6
0 0

WP-CLI is a tool that allows you to manage WordPress installations on your server from the command line. It can be very handy for efficient management of multiple WordPress installations. This guide assumes that you have already installed WordPress on a LAMP stack.

WP-CLI comes pre-installed on the Dekopon Stack One-Click WordPress app.

Step 1: Installing WP-CLI

Before we can actually use WP-CLI to manage WordPress, we need to install it:

cd ~
curl -k -L https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > wp-cli.phar

Test it:

php wp-cli.phar --info

This will display PHP information.

Step 2: Modifying ~/.bashrc

In order for the wp command to work, we need to alter our ~/.bashrc file. Open it, and add the following line:

alias wp="php /home/USERNAME/wp-cli.phar"

Now reload the file:

source ~/.bashrc

Step 3: Using WP-CLI

In order to use WP-CLI, navigate to the folder that contains your WordPress installation. You can now use WP-CLI commands in that folder. For example, try updating your WordPress installation with the following command:

wp core update

For a full list of WP-CLI commands, see the documentation on the official site.

Views: 6

Recent Articles

  • How to Set Up Dekopon Stack CDN Pull Zon...
    5
  • How to Set Up Dekopon Stack CDN Pull Zon...
    3
  • Hot Backups with Percona XtraBackup on t...
    6
  • Recovering Your WordPress Admin Password
    8
  • Using WP-CLI to Manage WordPress on Ubun...
    6

Popular Articles

  • Troubleshooting WordPress Database Error...
    125
  • How To Migrate WordPress To Dekopon Sta...
    57
  • Troubleshooting the WordPress White Scre...
    35
  • Upgrade One-Click WordPress without Down...
    19
  • Upgrade One-Click WordPress
    17
Live Chat